<html>
    <head>
        <h1>head</h1>

    </head>    
    <body>


        <form action='post' id='father'>
            <p>
                <span id='span'>请输入:</span> 
                <input type="text" id='ShuRuKuang'>
            </p>
            <p>
                <span>请选择性别:</span>
                <input type="radio" id="boy" name='sex' value="man">男
                <input type="radio" id="gril" name='sex' value="woman">女
            </p>
        </form>


        <script>
            'use strict';
            var myVar = {}; //自定义一个全局作用域，免得都绑在windows上
            myVar.form = document.getElementById('father');
            myVar.inputText = document.getElementById('ShuRuKuang');
            myVar.inputBoy = document.getElementById('boy');
            myVar.inputSpan = document.getElementById('span');
            myVar.inputTextFather = myVar.inputText.parentElement;


            myVar.myInput = document.createElement('input');
            myVar.myInput.setAttribute('type','text');
            myVar.myInput.setAttribute('id','myIput');
            myVar.myInput.value = 'dafdf';
            myVar.form.appendChild(myVar.myInput);
            myVar.form.appendChild
            myVar.inputTextFather.removeChild(myVar.inputText);

            console.log(myVar.inputText.value); //获取文本框的值
            myVar.inputText.value = 'xxx'; //修改文本框的值

            myVar.inputBoy.value; //获取单选框的值，一直都是man，所以也无法修改
            myVar.inputBoy.checked; //判断单选框这个选项（子节点）是否被选中，如果是返回true，如果假返回false
            myVar.inputBoy.checked = true; //把单选框的值修改到这个子节点中














            /*以下三段代码就是在用js自定义一个dom节点，相当于定义了：
              <h1 id='child4'>自己创建一个需要追加的节点</h1> */
            // myVar.appendDOM = document.createElement('h1'); 
            // myVar.appendDOM.setAttribute('id','child4');
            // myVar.appendDOM.innerText = '自己创建一个需要追加的节点';

            // myVar.father.appendChild(myVar.appendDOM);//把节点追加到father节点中
  








            //  var child = document.getElementById('child2');
            //  child.innerText = '222222222dafdfda';
            
            //  myVar.child1 = document.getElementById('child1');
            //  myVar.child1.innerHTML= '1111111dalffdahgh';
            //  myVar.child3 = document.getElementById('child3');
            //  myVar.child3.innerText = '给空的child3节点直接通过innerText添加新内容';

        </script>
    </body>


     <!--   
    <script>
        'use strict';
        var myVar = {};
        myVar.child1 = document.getElementById(child1);
        myVar.child1.innerText('dalffdahgh');

        var child = document.getElementById(child2);
        child.innerText('dafdfda');



        let str = `This is a stri
                    ng, a very goog
                    string`;
        //alert(str);
        console.log(str.length);


        var a = [1,2,3,4,5];
        console.log(a[0]);
        var b = ['daf','ewqr',2234,341,3411235,,78,425];
        b.forEach(element => {
            console.log(element);
        });

        var strTest = 'abvnmdsafjdldasf \
        dafjkgdf \
        edsahjffd \
        yryudaf';

        var mapTest = new Map([
            [1,'xiaoming'],
            ['2333','lihua'],
            [false,'lisi'],
            [{'objectkey':'objectvalue'},'zhangsan'],
            [[1,2,5,4],'wangwu']
            ]);

        mapTest.forEach(function(value,key,ownmap){
            console.log("map集合的键会被赋给回调函数的形参key："+key+'\n'+
                        "map集合的值会被赋给回调函数的形参value："+value);

        });

        var it = mapTest[Symbol.iterator]();
        var ita = a[Symbol.iterator]()
        



        var setTest = new Set([1,2,3,1,1,4]);
    </script>
    -->  

</html>